package com.small.nacos.config.server.model;


import small.common.designPattern.create.singleton.SingletonRepository;
import com.small.nacos.config.server.utils.SimpleReadWriteLock;

/**
 * @Author zhoujin
 * @Date 2022/11/23 13:42
 */
public class CacheItem {

    public SimpleReadWriteLock rwLock = new SimpleReadWriteLock();

    /**
     * 配置key
     */
    final String groupKey;

    /**
     * 最后更新时间
     */
    public volatile long lastModifiedTs;

    /**
     * 配置的md5
     */
    public volatile String md5 = "";
    /**
     * 配置文件类型
     */
    public String type;

    public CacheItem(String groupKey) {
        //获取单实例key
        this.groupKey = (String) SingletonRepository.SingletonData.getSingleton(groupKey);
    }

    public String getGroupKey() {
        return groupKey;
    }


    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        this.md5 = md5;
    }

    public long getLastModifiedTs() {
        return lastModifiedTs;
    }

    public void setLastModifiedTs(long lastModifiedTs) {
        this.lastModifiedTs = lastModifiedTs;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}
